﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using Model.WWW_User.Mail;
using BLL.WWW_User.Teach;
using System.Collections;
using Model.WWW_User.Teach;



namespace BLF.WWW_User.Teach
{
    public partial class Teach
    {
        #region 公共方法
        /// <summary>
        /// 用户开始时间字符串转换浏览者时区时间
        /// </summary>
        /// <param name="startDate">开始时间（年月日字符串）</param>
        /// <param name="startTime">开始时间（小时与分钟00：00）</param>
        /// <param name="timezone">浏览者时区</param>
        /// <returns>浏览者时区时间</returns>
        public static DateTime ConvertTime(string startDate, string startTime, string timezone)
        {
            try
            {
                DateTime dateTime = new DateTime(int.Parse(startDate.Substring(0, 4)), int.Parse(startDate.Substring(4, 2)), int.Parse(startDate.Substring(6, 2)));
                double h=0;
                double m=0;
                double tz = 0;
                string[] strSp=startTime.Split(':');
                if (strSp.Length > 1)
                {
                    double.TryParse(strSp[0], out h);
                    double.TryParse(strSp[1], out m);
                }
                double.TryParse(timezone, out tz);
                dateTime = dateTime.AddMinutes(h * 60 + m + tz);
                return dateTime;
            }
            catch
            {
                return new DateTime();
            }
        }
        /// <summary>
        /// 将用户时间计划表转换浏览者用户时间计划表
        /// </summary>
        /// <param name="timeList">用户时间列表</param>
        /// <param name="timezone">浏览者用户时区</param>
        /// <returns>浏览者时间列表</returns>
        public static List<Model.WWW_User.User.UserTimeAvailability> UserTimeAvaila(List<Model.WWW_User.User.UserTimeAvailability> timeList, string timezone)
        {
            if (timeList == null || timeList.Count <= 0) return null;
            if (timezone == timeList[0].Timezone || timezone == "")//判断用户时区是否等于浏览者时区，相等将用户时间列表排好序返回
            {
                timeList.Sort(new Model.WWW_User.User.TimeAvailabilityComparer());
                return timeList;
            }

            List<Model.WWW_User.User.UserTimeAvailability> timeList2 = new List<Model.WWW_User.User.UserTimeAvailability>();
            try
            {
                double tz = double.Parse(timezone) - double.Parse(timeList[0].Timezone);//计算浏览者时区与用户时区差值
                Model.WWW_User.User.UserTimeAvailability vtimeAvaila;
                DateTime dateTime = DateTime.Parse("2008-8-3");//设定固定日期（此时间为星期天‘0’，00：00）
                foreach (Model.WWW_User.User.UserTimeAvailability time in timeList)
                {
                    double week = double.Parse(time.Week);
                    string[] spFroT = time.FromTime.Split(':');
                    string[] spToT = time.ToTime.Split(':');
                    //用户开始时间与结束时间分别将周、小时、分钟、差值添加到固定日期上赋给一个froTime2、toTime2
                    DateTime froTime2 = dateTime.AddMinutes(week * 24 * 60 + double.Parse(spFroT[0]) * 60 + double.Parse(spFroT[1]) + tz);
                    DateTime toTime2 = dateTime.AddMinutes(week * 24 * 60 + double.Parse(spToT[0]) * 60 + double.Parse(spToT[1]) + tz);

                    if (froTime2.DayOfWeek == toTime2.DayOfWeek)//判断开始之间周与结束时间周是否相等，相等获取froTime2或toTime2时间的周，froTime2时间的小时与分钟，toTime2时间的小时与分钟，添加到列表
                    {
                        vtimeAvaila = new Model.WWW_User.User.UserTimeAvailability();
                        vtimeAvaila.Week = ((int)froTime2.DayOfWeek).ToString();
                        vtimeAvaila.FromTime = froTime2.ToString("HH:mm");
                        vtimeAvaila.ToTime = toTime2.ToString("HH:mm");
                        timeList2.Add(vtimeAvaila);
                    }
                    else
                    {//不相等将取出froTime2时间周、小时与分钟赋给新的对象周、开始时间，结束时间为当天最后时刻“23：59” 添加到列表；
                        //再将toTime2时间里的周、结束时间取出赋给新的对象，开始时间从0点开始 添加到列表
                        vtimeAvaila = new Model.WWW_User.User.UserTimeAvailability();
                        vtimeAvaila.Week = ((int)froTime2.DayOfWeek).ToString();
                        vtimeAvaila.FromTime = froTime2.ToString("HH:mm");
                        vtimeAvaila.ToTime = "23:59";
                        timeList2.Add(vtimeAvaila);

                        vtimeAvaila = new Model.WWW_User.User.UserTimeAvailability();
                        vtimeAvaila.Week = ((int)toTime2.DayOfWeek).ToString();
                        vtimeAvaila.FromTime = "00:00";
                        vtimeAvaila.ToTime = toTime2.ToString("HH:mm");
                        timeList2.Add(vtimeAvaila);
                    }
                }
            }
            catch
            {
                return null;
            }
            timeList2.Sort(new Model.WWW_User.User.TimeAvailabilityComparer());
            return timeList2;
        }
        /// <summary>
        /// 获取course类型文本
        /// </summary>
        /// <param name="value">值</param>
        /// <returns>文本</returns>
        public static string GetCTypeText(string value)
        {
            string typeStr = "";
            switch (value)
            {
                case "0":
                    typeStr = Lx.Web.Common.Resource.GetText(Lx.Web.Common.UI.Globals.Language, "WK615");//General
                    break;
                case "1":
                    typeStr = Lx.Web.Common.Resource.GetText(Lx.Web.Common.UI.Globals.Language, "WK616");
                    break;
                case "2":
                    typeStr = Lx.Web.Common.Resource.GetText(Lx.Web.Common.UI.Globals.Language, "WK617");
                    break;
                case "3":
                    typeStr = Lx.Web.Common.Resource.GetText(Lx.Web.Common.UI.Globals.Language, "WK618");
                    break;
                case "4":
                    typeStr = Lx.Web.Common.Resource.GetText(Lx.Web.Common.UI.Globals.Language, "WK619");
                    break;
                case "5":
                    typeStr = Lx.Web.Common.Resource.GetText(Lx.Web.Common.UI.Globals.Language, "WK620");
                    break;
                case "Z":
                    typeStr = Lx.Web.Common.Resource.GetText(Lx.Web.Common.UI.Globals.Language, "WK621");//Other
                    break;
            }
            return typeStr;
        }
        /// <summary>
        /// 获取级别水平文本(相连文本。从低级到高级)
        /// </summary>
        /// <param name="value">值</param>
        /// <returns>级别水平文本</returns>
        public static string GetLevelText(string value)
        {
            string textStr = "";
            int valLen = value.Length;
            int i = 0;
            while (i < valLen)
            {
                string subStr = value.Substring(i, 1);
                string levelStr = "";
                switch (subStr)
                {
                    case "1":
                        levelStr = Lx.Web.Common.Resource.GetText(Lx.Web.Common.UI.Globals.Language, "C0019");
                        break;
                    case "2":
                        levelStr = Lx.Web.Common.Resource.GetText(Lx.Web.Common.UI.Globals.Language, "C0020");
                        break;
                    case "3":
                        levelStr = Lx.Web.Common.Resource.GetText(Lx.Web.Common.UI.Globals.Language, "C0021");
                        break;
                    case "4":
                        levelStr = Lx.Web.Common.Resource.GetText(Lx.Web.Common.UI.Globals.Language, "C0022");
                        break;
                    case "5":
                        levelStr = Lx.Web.Common.Resource.GetText(Lx.Web.Common.UI.Globals.Language, "C0023");
                        break;
                }
                if (i == 0)
                {
                    textStr = levelStr;
                    i = valLen > 1 ? valLen - 1 : valLen;
                }
                else if (i == (valLen - 1))
                {
                    textStr = textStr + " - " + levelStr;
                    i = valLen;
                }
            }
            return textStr;
        }
        #endregion

        /// <summary>
        /// 添加申请老师的资料
        /// </summary>
        /// <param name="tm">老师模型</param>
        /// <returns>BOOL</returns>
        static public bool AddTeachProfile(TeachModel tm)
        {
            TeachSystem ts = new TeachSystem();
            return ts.AddTeachProfile(tm);
        }
        /// <summary>
        /// 添加申请老师资料2
        /// </summary>
        /// <param name="MotherTongue">母语</param>
        /// <param name="MotherTongueLevel">母语等级</param>
        /// <param name="MotherTongue2">母语2</param>
        /// <param name="MotherTongue2Level">母语2等级</param>
        /// <param name="MotherTongue3">母语3</param>
        /// <param name="MotherTongue3Level">母语3等级</param>
        /// <param name="MotherTongue4">母语4</param>
        /// <param name="MotherTongue4Level">母语4等级</param>
        /// <param name="Nickname">昵称</param>
        /// <param name="Nationality">来自国家</param>
        /// <param name="Hometown">故乡</param>
        /// <param name="Country">所在国家</param>
        /// <param name="City">城市</param>
        /// <param name="Gender">性别</param>
        /// <param name="BOD">出生日期</param>
        /// <param name="IsShowBod">是否显示年龄</param>
        /// <param name="Education">学历</param>
        /// <param name="OccupationCat">职业</param>
        /// <param name="Occupation">职业类型等级</param>
        /// <param name="IMType">名字</param>
        /// <param name="IMValue">姓氏</param>
        /// <param name="Address">地址</param>
        /// <param name="Address2">地址2</param>
        /// <param name="ZipCode">邮编</param>
        /// <param name="Telphone">电话</param>
        /// <returns>BOOL</returns>
        static public bool AddTeachProfile2(string memberno, string MotherTongue, string MotherTongueLevel, string MotherTongue2, string MotherTongue2Level, string MotherTongue3, string MotherTongue3Level, string MotherTongue4, string MotherTongue4Level,
            string Nickname, string Nationality, string Hometown, string Country, string City, string Gender, string BOD, bool IsShowBod, string Education, string OccupationCat, string Occupation, string IMType, string IMValue, string Address, string Address2, string ZipCode, string Telphone)
        {
            TeachSystem ts = new TeachSystem();
            return ts.AddTeachProfile2(memberno, MotherTongue, MotherTongueLevel, MotherTongue2, MotherTongue2Level, MotherTongue3, MotherTongue3Level, MotherTongue4, MotherTongue4Level,
             Nickname, Nationality, Hometown, Country, City, Gender, BOD, IsShowBod, Education, OccupationCat, Occupation, IMType, IMValue, Address, Address2, ZipCode, Telphone);
        }
        /// <summary>
        /// 得到老师的简单信息
        /// </summary>
        /// <param name="memberno">会员号</param>
        /// <returns>ArryList 0;nickname,1:nationality,2mothertongue</returns>
        static public ArrayList GetTeachPro(string memberno)
        {
            TeachSystem ts = new TeachSystem();
            return ts.GetTeachPro(memberno);
        }
        /// <summary>
        /// 添加申请老师资料3
        /// </summary>
        /// <param name="memberno">会员号</param>
        /// <param name="Introduction">自我介绍</param>
        /// <param name="VideoCode">视频代码</param>
        /// <returns>BOOL</returns>
        static public bool AddTeachProfile3(string memberno, string Introduction, string VideoCode, string os)
        {
            TeachSystem ts = new TeachSystem();
            return ts.AddTeachProfile3(memberno, Introduction, VideoCode, os);
        }
        /// <summary>
        /// 得到申请老师的步骤
        /// </summary>
        /// <param name="memberno">会员号</param>
        /// <returns>string-1为服务器出错，为0就是还没申请，其余看步骤</returns>
        static public string GetApTeach(string memberno)
        {
            TeachSystem ts = new TeachSystem();
            return ts.GetApTeach(memberno);
        }
        /// <summary>
        /// 得到老师的简单信息
        /// </summary>
        /// <param name="memberno">会员号</param>
        /// <returns>ArryList 0;申请教师的步骤,1:Introduction 2</returns>
        static public ArrayList GetTeachProIn(string memberno)
        {
            TeachSystem ts = new TeachSystem();
            return ts.GetTeachProIn(memberno);
        }
        /// <summary>
        /// 得到老师的简单信息
        /// </summary>
        /// <param name="memberno">会员号</param>
        /// <returns>ArryList 0;申请教师的步骤,1:TeachModel </returns>
        static public ArrayList GetTeachTime(string memberno)
        {
            TeachSystem ts = new TeachSystem();
            return ts.GetTeachTime(memberno);
        }

        #region teacher
        /// <summary>
        /// 搜索教师(0：结果数量int、1：教师列表TeachModel list)
        /// </summary>
        /// <param name="memberno">当前会员号</param>
        /// <param name="tType">教师类型1职业教师、2辅导老师（空表示所有）</param>
        /// <param name="tl">教学语言</param>
        /// <param name="bl">母语</param>
        /// <param name="nation">国籍</param>
        /// <param name="maxPrice">最大时薪</param>
        /// <param name="minPrice">最小时薪</param>
        /// <param name="isFree">是否只显示免费的</param>
        /// <param name="isNativeBL">是否只显示母语1为教学语言的</param>
        /// <param name="sortby">排序 1：LastLogin desc、2：StarRate desc、3：Sessions desc、4：Price asc</param>
        /// <param name="pageIndex">pageIndex</param>
        /// <param name="pageSize">pageSize</param>
        /// <returns>ArrayList</returns>
        public static ArrayList GetFindTeacher(string memberno, string tType, string tl, string bl, string nation, decimal maxPrice, decimal minPrice, bool isFree, bool isNativeBL, string sortby, int pageIndex, int pageSize)
        {
            string key = string.Format("FindTeacher_{0}_{1}_{2}_{3}_{4}_{5}_{6}_{7}_{8}_{9}_{10}", tType, tl, bl, nation, maxPrice, minPrice, isFree, isNativeBL, sortby, pageIndex, pageSize);
            ArrayList arrayList = (ArrayList)BizObject.Cache[key];
            if (arrayList == null)
            {
                arrayList = new TeachSystem().GetFindTeacher(memberno, tType, tl, bl, nation, maxPrice, minPrice, isFree, isNativeBL, sortby, pageIndex, pageSize);
                if (arrayList == null) return null;
                BizObject.Cache.Insert(key, arrayList, null, DateTime.Now.AddHours(IProvider.Common.CacheTime), TimeSpan.Zero);
            }
            return arrayList;
        }
        /// <summary>
        /// 根据具体信息搜索教师(0：结果数量int、1：教师列表TeachModel list)
        /// </summary>
        /// <param name="nnMnMe">昵称名或会员email或会员号</param>
        /// <param name="memberno">当前会员号</param>
        /// <param name="sortby">排序 1：LastLogin desc、2：StarRate desc、3：Sessions desc、4：Price asc</param>
        /// <param name="pageIndex">pageIndex</param>
        /// <param name="pageSize">pageSize</param>
        /// <returns>(0：结果数量int、1：教师列表TeachModel list)</returns>
        public static ArrayList GetFindTeacher_MN(string nnMnMe, string memberno, string sortby, int pageIndex, int pageSize)
        {
            return new TeachSystem().GetFindTeacher_MN(nnMnMe, memberno, sortby, pageIndex, pageSize);
        }
        /// <summary>
        /// 根据爱好搜索教师(0：结果数量int、1：教师列表TeachModel list)
        /// </summary>
        /// <param name="favorite">兴趣爱好</param>
        /// <param name="memberno">当前会员号</param>
        /// <param name="sortby">排序 1：LastLogin desc、2：StarRate desc、3：Sessions desc、4：Price asc</param>
        /// <param name="pageIndex">pageIndex</param>
        /// <param name="pageSize">pageSize</param>
        /// <returns>(0：结果数量int、1：教师列表TeachModel list)</returns>
        public static ArrayList GetTeacher_Favorite(int favorite, string memberno, string sortby, int pageIndex, int pageSize)
        {
            return new TeachSystem().GetTeacher_Favorite(favorite, memberno, sortby, pageIndex, pageSize);
        }
        /// <summary>
        /// 根据当前所在国家搜索教师(0：结果数量int、1：教师列表TeachModel list)
        /// </summary>
        /// <param name="country">兴趣爱好</param>
        /// <param name="memberno">当前会员号</param>
        /// <param name="sortby">排序 1：LastLogin desc、2：StarRate desc、3：Sessions desc、4：Price asc</param>
        /// <param name="pageIndex">pageIndex</param>
        /// <param name="pageSize">pageSize</param>
        /// <returns>(0：结果数量int、1：教师列表TeachModel list)</returns>
        public static ArrayList GetTeacher_Country(string country, string memberno, string sortby, int pageIndex, int pageSize)
        {
            return new TeachSystem().GetTeacher_Country(country, memberno, sortby, pageIndex, pageSize);
        }
        /// <summary>
        /// 获取Categories页的数据 0：最近一周更新的老师MemberSimpleModel List、1：最新的老师
        /// </summary>
        /// <returns>ArrayList</returns>
        public static ArrayList GetCategoriesTeacher(string tl)
        {            
            string key = string.Format("TeacherCategories_{0}", tl);
            ArrayList arrayList = (ArrayList)BizObject.Cache[key];
            if (arrayList == null)
            {
                arrayList = new TeachSystem().GetCategoriesTeacher(tl);
                BizObject.Cache.Insert(key, arrayList, null, DateTime.Now.AddDays(IProvider.Common.CacheTime12), TimeSpan.Zero);
            }
            return arrayList;
        }
        #endregion

        #region course
        /// <summary>
        /// 搜索课件(0：搜索数量int、1：课件列表CoursesModel list、2：tag列表 string list)
        /// </summary>
        /// <param name="TL">所教语言</param>
        /// <param name="level">适合级别</param>
        /// <param name="cType">course type</param>
        /// <param name="maxPrice">最大价格</param>
        /// <param name="minPrice">最小价格</param>
        /// <param name="isFree">是否只显示免费的</param>
        /// <param name="isNativeBL">是否只显示课件作者母语1为教学语言的</param>
        /// <param name="sortby">排序 1：UpdateDate desc、2：StarRate desc、3：Sessions desc、4：Price asc</param>
        /// <param name="pageIndex">pageIndex</param>
        /// <param name="pageSize">pageSize</param>
        /// <returns>ArrayList</returns>
        public static ArrayList GetFindCourse(string TL, string level, string cType, decimal maxPrice, decimal minPrice, bool isFree, bool isNativeBL, string sortby, int pageIndex, int pageSize)
        {
            string ckey = string.Format("FindCourse_{0}_{1}_{2}_{3}_{4}_{5}_{6}_{7}_{8}_{9}", TL, level, cType, maxPrice, minPrice, isFree, isNativeBL, sortby, pageIndex, pageSize);
            ArrayList arrayList = (ArrayList)BizObject.Cache[ckey];
            if (arrayList == null)
            {
                arrayList = new TeachSystem().GetFindCourse(TL, level, cType, maxPrice, minPrice, isFree, isNativeBL, sortby, pageIndex, pageSize);
                if (arrayList == null) return null;
                BizObject.Cache.Insert(ckey, arrayList, null, DateTime.Now.AddHours(IProvider.Common.CacheTime), TimeSpan.Zero);
            }
            return arrayList;
        }
        /// <summary>
        /// 根据Key搜索课件(0：搜索数量int、1：课件列表CoursesModel list、2：tag列表 string list)
        /// </summary>
        /// <param name="TL">所教语言</param>
        /// <param name="key">搜索关键字（course的标题、tag）</param>
        /// <param name="sortby">排序 1：UpdateDate desc、2：StarRate desc、3：Sessions desc、4：Price asc</param>
        /// <param name="pageIndex">pageIndex</param>
        /// <param name="pageSize">pageSize</param>
        /// <returns>(0：搜索数量int、1：课件列表CoursesModel list、2：tag列表 string list))</returns>
        public static ArrayList GetFindCourse_Key(string TL, string key, string sortby, int pageIndex, int pageSize)
        {
            return new TeachSystem().GetFindCourse_Key(TL, key, sortby, pageIndex, pageSize);
        }
        /// <summary>
        /// 根据TAG搜索课件(0：搜索数量int、1：课件列表CoursesModel list、2：tag列表 string list、3：相关tag string list)
        /// </summary>
        /// <param name="TL">所教语言</param>
        /// <param name="tag">tag</param>
        /// <param name="sortby">排序 1：UpdateDate desc、2：StarRate desc、3：Sessions desc、4：Price asc</param>
        /// <param name="pageIndex">pageIndex</param>
        /// <param name="pageSize">pageSize</param>
        /// <returns>(0：搜索数量int、1：课件列表CoursesModel list、2：tag列表 string list))</returns>
        public static ArrayList GetFindCourse_Tag(string TL, string tag, string sortby, int pageIndex, int pageSize)
        {
            return new TeachSystem().GetFindCourse_Tag(TL, tag, sortby, pageIndex, pageSize);
        }
        /// <summary>
        /// 获取Categories页的数据(0：最近一个月Session最多的Courses CoursesModel List、1：最后更新的5个courses CoursesModel List)
        /// </summary>
        /// <param name="tl">课件所学语言</param>
        /// <returns>ArrayList</returns>
        public static ArrayList GetCategoriesCourse(string tl)
        {
            string key = string.Format("CourseCategories_{0}", tl);
            ArrayList arrayList = (ArrayList)BizObject.Cache[key];
            if (arrayList == null)
            {
                arrayList = new TeachSystem().GetCategoriesCourse(tl);
                BizObject.Cache.Insert(key, arrayList, null, DateTime.Now.AddDays(IProvider.Common.CacheTime12), TimeSpan.Zero);
            }
            return arrayList;
        }
        /// <summary>
        /// 获取课件里tag列表
        /// 0：一个星期内课件使用的TAG 按使用数排序string[0 Tile;1 Tagcout] List
        /// 1：所有course使用的TAG 按使用数排序string[0 Tile;1 Tagcout] List
        /// 2：最近一周内成功session数从大到小排序，取5个教程；不够时，按最后发布时间倒序排序CoursesModel List
        /// 3：最新的5个教程CoursesModel List
        /// </summary>
        /// <param name="tl">所教语言</param>
        /// <returns>ArrayList</returns>
        public static ArrayList GetCTags(string tl)
        {
            string key = string.Format("CourseTags_{0}", tl);
            ArrayList arrayList = (ArrayList)BizObject.Cache[key];
            if (arrayList == null)
            {
                arrayList = new TeachSystem().GetCTags(tl);
                BizObject.Cache.Insert(key, arrayList, null, DateTime.Now.AddDays(IProvider.Common.CacheTime12), TimeSpan.Zero);
            }
            return arrayList;
        }
        /// <summary>
        /// 获取一个课件信息 0：course详细信息CoursesModel
        /// 1：ArrayList(0：当前course更新时间 DateTime、1：此course的老师母语string、2：此course的老师所有session数int、3：此course的教师身份是否有效bool、4浏览者时区stirng)
        /// 2：course的tag列表string List
        /// 3：course的lesson列表 LessonModel List
        /// 4：course的session列表SessionsModel List
        /// 5：course的老师授课可用时间列表UserTimeAvailability List
        /// 6：course的老师的其他course列表(不包括本course) CoursesModel List
        /// 7：与本course所学语言相同的其他course列表(不包括本course) CoursesModel List
        /// </summary>
        /// <param name="memberno">当前会员号</param>
        /// <param name="cid">courseID</param>
        /// <param name="sessionID">用户sessionID</param>
        /// <param name="ip">ip</param>
        /// <param name="userAgent">userAgent</param>
        /// <param name="referer">referer</param>
        /// <returns>ArrayList</returns>
        public static ArrayList GetACourse(string memberno, long cid, string sessionID, string ip, string userAgent, string referer)
        {
            return new TeachSystem().GetACourse(memberno, cid, sessionID, ip, userAgent, referer);
        }
        /// <summary>
        /// 获取一个课件信息并删除一个lesson 0：course详细信息CoursesModel
        /// 1：ArrayList(0：当前course更新时间 DateTime、1：此course的老师母语string、2：此course的老师所有session数int、3：此course的教师身份是否有效bool、4浏览者时区stirng)
        /// 2：course的tag列表string List
        /// 3：course的lesson列表 LessonModel List
        /// 4：course的session列表SessionsModel List
        /// 5：course的老师授课可用时间列表UserTimeAvailability List
        /// 6：course的老师的其他course列表(不包括本course) CoursesModel List
        /// 7：与本course所学语言相同的其他course列表(不包括本course) CoursesModel List
        /// </summary>
        /// <param name="memberno">当前会员号</param>
        /// <param name="cid">courseID</param>
        /// <param name="lid">lessionID</param>
        /// <returns>ArrayList</returns>
        public static ArrayList GetACourseDelLesson(string memberno, long cid, long lid)
        {
            return new TeachSystem().GetACourseDelLesson(memberno, cid, lid);
        }
        /// <summary>
        /// 获取某个课件的session (0：这个course信息CoursesModel、1：session数量int、2：session列表SessionsModel List)
        /// </summary>
        /// <param name="cid">course ID</param>
        /// <param name="pageIndex">pageIndex</param>
        /// <param name="pageSize">pageSize</param>
        /// <returns>ArrayList</returns>
        public static ArrayList GetACourseSessions(long cid, int pageIndex, int pageSize)
        {
            return new TeachSystem().GetACourseSessions(cid, pageIndex, pageSize);
        }
        #endregion

        #region session
        /// <summary>
        /// 获取一个session信息（0：当前用户类型1学生 2老师 0此session不是该用户的string、
        /// 1：SessionsModel、2：timezone string、3：历史记录列表History List、4：消息列表 CommentModel List）、5：string List 0学生学习工具 1老师教学工具
        /// </summary>
        /// <param name="memberno">当前会员号</param>
        /// <param name="sid">session id</param>
        /// <returns>ArrayList</returns>
        public static ArrayList GetASession(string memberno, long sid)
        {
            return new TeachSystem().GetASession(memberno, sid);
        }
        /// <summary>
        /// 获取一个session信息（0：当前用户类型1学生 2老师 0此session不是该用户的string、
        /// 1：SessionsModel、2：timezone string、3：历史记录列表History List、4：消息列表 CommentModel List）、5：string List 0学生学习工具 1老师教学工具
        /// </summary>
        /// <param name="memberno">当前会员号</param>
        /// <param name="sid">session id</param>
        /// <param name="op">操作("1":学生取消申请、"4":老师拒绝、"G":老师feedback)</param>
        /// <param name="tToSDesc">反馈内容（当op="G"时才有效）</param>
        /// <returns></returns>
        public static ArrayList GetASessionOp(string memberno, long sid, string op, string tToSDesc)
        {
            return new TeachSystem().GetASessionOp(memberno, sid, op, tToSDesc);
        }
        /// <summary>
        /// 添加并获取session消息 0：CommentModel List 消息列表
        /// </summary>
        /// <param name="sendNo">发送号</param>
        /// <param name="sid">session id</param>
        /// <param name="msg">消息</param>
        /// <returns>ArrayList</returns>
        public static ArrayList AddGetMessage(string sendNo, long sid, string msg)
        {
            return new TeachSystem().AddGetMessage(sendNo, sid, msg);
        }
        /// <summary>
        /// 获取lesson内容
        /// </summary>
        /// <param name="lid">lesson id</param>
        /// <returns>string</returns>
        public static string GetLessonDesc(long lid)
        {
            return new TeachSystem().GetLessonDesc(lid);
        }
        #endregion        

        /// <summary>
        /// 得到老师的信息TeachModel
        /// </summary>
        /// <param name="memberno">老师会员号</param>
        /// <returns>ArrayList</returns>
        static public ArrayList GetTeaching(string memberno)
        {
            TeachSystem ts = new TeachSystem();
            return ts.GetTeaching(memberno);
        }
        /// <summary>
        /// 修改老师的资料
        /// </summary>
        /// <param name="tm">老师模型</param>
        /// <returns>BOOL</returns>
        static public bool UpdateTeachProfile(TeachModel tm)
        {
            TeachSystem ts = new TeachSystem();
            return ts.UpdateTeachProfile(tm);
        }
    }
}
     